#include<stdio.h>
#include<math.h>
class Point
{
    public:
        Point(int xx, int yy);
        Point(const Point &p);
        int GetX() const {return X;}
        int GetY() const {return Y;}
    private:
        int X, Y;
};
Point::Point(int xx, int yy)
{
    X = xx;
    Y = yy;
    printf("X = %d, Y = %d\n", X, Y);
    printf("Point::Point construct %p\n", this);
}
Point::Point(const Point &p)
{
    X = p.X;
    Y = p.Y;
    printf("X = %d, Y = %d\n", X, Y);
    printf("Point::Point copy construct %p\n", this);
}

class Line
{
    public:
        Line(Point x, Point y);
        Line(const Line &);
        double GetLine() const {return len;}
    private:
        Point p1, p2;
        double len;
    
};
Line::Line(Point x, Point y):p1(x),p2(y)
{
    printf("Line::Line construct %p\n", this);
    int xx = p1.GetX() - p2.GetX();  
    int yy = p1.GetY() - p2.GetY();  
    len = sqrt(xx*xx + yy*yy);
    printf("xx = %d, yy = %d, len = %f\n", xx, yy, len);
}
Line::Line(const Line &p):p1(p.p1),p2(p.p2)
{
    p1 = p.p1;
    p2 = p.p2;
    len = p.len;
    printf("Line::Line copy construct %p\n", this);
}

int main(int argc, char *argv[])
{
    Point myp1(1, 2), myp2(3, 4);
    Line line1(myp1, myp2);
    printf("Line1 %f\n", line1.GetLine());
    Line line2(line1);
    printf("Line2 %f\n", line2.GetLine());
    return 0;
}
